﻿@model MileageStats.Web.Models.FillupEntryFormModel
@Html.AntiForgeryToken()
@{
    var today = DateTime.Now;
}
@Html.ValidationSummary(true)
<ul id="fillupForm" data-fillup-stations-url="@Url.Action("GetFillupStations", "GeoLocation")">
    <li class="psuedo-date">
        <label for="Date">Date</label>
        @Html.ValidationMessageFor(model => model.Date)
        @Html.DropDownListFor(model => model.DateMonth, SelectListFor.Month(i => today.Month == i))
        @Html.DropDownListFor(model => model.DateDay, SelectListFor.Date(i => today.Day == i))
        @Html.DropDownListFor(model => model.DateYear, SelectListFor.Year(i => today.Year == i))
    </li>
    <li>
        @Html.LabelFor(model => model.Odometer)
        @Html.ValidationMessageFor(model => model.Odometer)
        @Mustache.InputTypeFor(model => model.Odometer, (Model != null && Model.Odometer > 0) ? Model.Odometer.ToString() : null)
    </li>
    <li>
        @Html.LabelFor(model => model.PricePerUnit)
        @Html.ValidationMessageFor(model => model.PricePerUnit)
        @Mustache.InputTypeFor(model => model.PricePerUnit)
    </li>
    <li>
        @Html.LabelFor(model => model.TotalUnits)
        @Html.ValidationMessageFor(model => model.TotalUnits)
        @Mustache.InputTypeFor(model => model.TotalUnits)
    </li>
    @if(Html.IsRenderingForMustache())
    {
    <li id="GeoLocationSelect">
		<label for="Location">Fill-up station</label>
		<select name="Location"></select>
	</li>
	<li id="GeoLocationCheckbox">
		<input type="checkbox" name="use-api-location" value="1" />Locate nearby fill-up stations.
	</li>
	<li>
        <label for="new-location">Or add a new fill-up station</label>
        @Html.LabelFor(model => model.Vendor)
        @Html.ValidationMessageFor(model => model.Vendor)
        @Mustache.TextBoxFor(model => model.Vendor, new { maxlength = "20" }) 
	</li>

    }
    else
    {
    <li>
        @Html.LabelFor(model => model.Vendor)
		@Html.ValidationMessageFor(model => model.Vendor)
        @Mustache.TextBoxFor(model => model.Vendor, new { maxlength = "20" }) 
    </li>
    }
    
    <li>
        @Html.LabelFor(model => model.TransactionFee)
        @Html.ValidationMessageFor(model => model.TransactionFee)
        @Mustache.InputTypeFor(model => model.TransactionFee)
    </li>
   <li>
        @Html.LabelFor(model => model.Remarks)
		@Html.ValidationMessageFor(model => model.Remarks)
        @Mustache.TextAreaFor(model => model.Remarks, new { maxlength = "250", wrap = "soft" }) 
    </li>
</ul>

<ol class="hbox button-group">
	<li><button type="submit"><span>Save</span></button></li>
	<li class="icon false invert"><a href="@Url.UnencodedAction("List", "Fillup", new { vehicleId = Mustache.RouteValue("vehicleId") })"><span>Cancel</span></a></li>
</ol>
